Introduction to Computing Technologies: Links

Authors

Professor Vincent R. Nijs

Rady School of Management @ UCSD

1 Introduction

The Introduction to Computing Technolgies (ICT) workshop will ensure everyone is set up with the tools needed to start and complete the Rady MSBA program successfully.

Use the links and required documentation in this document before, during, and after the ICT workshop as stated next to each header. Each section header indicates when you should take the suggested steps.

When we mention your MSBA program or cohort site on Canvas we are refering to the sites linked below:

During the ICT session we will ask you to sit with your assigned study group. The MSBA ICT support team will be walking around to help out. You can also post screenshots and what happend on your computer to the Google Sheet below or to the RADY499 piazza site linked below and we will provide support as quickly as possible.

https://docs.google.com/presentation/d/1Fd-EPFC9f8ZGWSZJzRoE8-6chDj-vrYh3nICQV0I5no/edit?usp=sharing

https://piazza.com/ucsd/summer2023/rady499

1.1 Provide your student profile (before or after workshop)

Please provide all the information requested on the page linked below:

https://rsm-compute-01.ucsd.edu:4443/rady-profiles/

To login, provide the first part of your @ucsd.edu email (NOT your @rady.ucsd.edu email). The password is the same one you use to access your UCSD email. Once you have logged on, “Profile Submission Form” in the navigation bar and complete the form. You don’t have to complete everything in one go, however. You can revisit the page and udpate your information any time.

1.2 Store this HTML file on your Desktop (before workshop)

Please save this HTML file to your Desktop. After the workshop move the file to a location you can remember as you will likely need to access it frequently over time.

1.3 Install the Zoom app on our computer (before workshop)

Note: This section on zoom is relevant for Part-time FW MSBA students only

You must have the zoom app installed on your computer to have access to all relevant features (i.e., don’t use Zoom through your browser).

https://ucsd.zoom.us/download

Click the link below to claim your UC San Diego Zoom Pro account using Single Sign-On (SSO).

https://ucsd.zoom.us/signin

The ICT workshop is in-person. If you must join remotely, and this is your first experience with zoom for a class or workshop, please review the linked document below so you are comfortable in this environment:

https://bit.ly/3mcAI0L

Two key issues if you are joining a class through zoom:

  1. You must have a working webcam so you can you have your video on and everyon in the classroom can see you
  2. Make sure to use a virtual background (see the zoom tutorial page)

1.4 Install the iClicker Student app on your phone (before workshop)

The iClicker Student app is created by HPHLP. You should create an account through the link below:

https://student.iclicker.com/#/account/create

The video linked below show the install process for Android. The process on iOS is very similar:

https://www.youtube.com/watch?v=liozvhPhtJA

Add a class from the “University of CA San Diego Rady School of Management” by searching for “Rady”. Once you have found the school, search for and add one of the below classes depending on your program:

  • University of CA San Diego Rady Sch Management > Introduction to Computing Technologies (FT)
  • University of CA San Diego Rady Sch Management > Introduction to Computing Technologies (FW)

This app will be used in many of your classes in the MSBA program so please ensure you have it installed on your phone.

Note: You can also participate in iClicker polls from your laptop through: https://www.iclicker.com/students/apps-and-remotes/web/

1.5 Browser (before workshop)

Unless you have a strong preference for Firefox or Safari (macOS), we recommend you use Chrome as your default browser. The application is available for free through the link below:

https://www.google.com/chrome/

On Windows, you can also use Microsoft’s Edge browser, which is built on the Chromium rendering engine.

Note: A major advantage of using the Edge browser is that Bing Chats (Creative model) uses GPT4 to evaluate prompts.

1.6 Programming and technical support through Piazza (before or during workshop)

Many of your classes will use piazza as a discussion and question & answer forum. To sign-up for the Piazza site where you can ask general programming technical questions go to https://piazza.com/ucsd/summer2023/rady499 and provide the information shown below:

  • School: UCSD
  • Term: Summer 2023
  • Course Number: Rady 499
  • Course Name: Technical and Programming Support

Rady will have a Tech and Programming TA to support you throughout the year for general programming questions and teachnical issues related to the tools used in the MSBA program and discussed during the ICT session. Please use the Piazza site and their weekly office hours to connect with the Tech and Programming TA.

1.7 Piazza site for the AI-Assisted Math and Programming for Business Analtyics class (before or during workshop)

To sign-up for the Piazza site for the AI-Assisted Math and Programming for Business Analtyics class for FT MSBA go to https://piazza.com/ucsd/summer2023/mgta403ft and provide the information shown below:

  • School: UCSD Rady School of Management
  • Term: Summer 2023
  • Course Number: MGTA 403 (FT)
  • Course Name: AI-Assisted Math and Programming for Business Analytics (FT)

To sign-up for the Piazza site for the AI-Assisted Math and Programming for Business Analtyics class for FW MSBA go to https://piazza.com/ucsd/summer2023/mgta403fw and provide the information shown below:

  • School: UCSD Rady School of Management
  • Term: Summer 2023
  • Course Number: MGTA 403 (FW)
  • Course Name: AI-Assisted Math and Programming for Business Analytics (FW)

1.8 Install VPN to access the MSBA server from off-campus (before workshop)

Several of the tools we will use in the program run on the MSBA server and require VPN to access. Please install UCSDs VPN tools for your platform using the information linked below:

Rady IT put together a video about using VPN: https://www.youtube.com/watch?v=lbfO74NfAEE

1.9 Download and install Google Drive for Desktop (any time)

As a UCSD student you already have a Google Drive account. To install the Desktop software, use the instructions linked below:

Google Drive for Desktop

You must have the app installed on your computer so that files can sync to your harddrive and are directly accessible. Select a directory and right-click to enable offline access (Offline access > Available offline) otherwise you won’t be able to load the file into VS Code, Jupyter, etc.

2 General MSBA prepartion work

2.1 Required books for AI-Assisted Math and Programming for Business Analytics course (after workshop)

A new book just came out that will be used as a reference in the AI-Assisted Math and Programming for Business Analytics course. Make sure you have access to the book and check on the canvas site for the course which chapters you are expected to read.

Learn AI-assisted Python Programming

Please note that the goal for the course is NOT to make you a Python software developer. Rather, it is to help you efficiently solve Business Analytics problems that are important for an organization with (python) code. To achieve this objective you will learn to utilize AI tools like GitHub Copilot and ChatGPT Code Interpreter.

Chapters from an additional book will be provided through the Canvas course site.

2.2 Required DataCamp course work (by duedate)

Complete all tracks, courses, and chapters before the workshshop. Submit a screenshot showning you have completed all required assignments on DataCamp through the Canvas program site for your cohort (see links above).

Python:

R:

Bash:

SQL:

You should also work through the 10 minute interactive markdown tutorial: https://commonmark.org/help

2.3 Math and Stats Bootcamp (by duedate)

Complete all quiz questions on the Math and Stats Bootcamp site. We will collect data from the server and review the results.

https://rsm-compute-01.ucsd.edu:4443/msbabootcamp2023/

3 Set up required tools for the MSBA program

3.1 Install Docker and update the RSM-MSBA (INTEL or ARM) computing environment (before workshop)

Windows:

Full install instructions: https://github.com/radiant-rstats/docker/blob/master/install/rsm-msba-windows.md

If you already followed these instructions, please update your install to the latest version of the docker image by running the code below in an Ubuntu terminal:

docker pull vnijs/rsm-msba-intel;
docker rmi vnijs/rsm-jupyter-rs; # cleanup if needed
rm -rf ~/git/docker;
git clone https://github.com/radiant-rstats/docker.git ~/git/docker;
~/git/docker/launch-rsm-msba-intel.sh -v ~;

We recommend using Windows Terminal and then selecting an Ubuntu terminal from there as shown in the screenshot below:

macOS (M1 or M2):

If you already followed these instructions, please update your install to the latest version of the docker image by running the code below in a macOS terminal:

docker pull vnijs/rsm-msba-arm;
docker rmi vnijs/rsm-jupyter; # cleanup if needed
rm -rf ~/git/docker;
git clone https://github.com/radiant-rstats/docker.git ~/git/docker;
cp -p ~/git/docker/launch-rsm-msba-arm.sh ~/Desktop/launch-rsm-msba.command;
~/Desktop/launch-rsm-msba.command;

macOS (Intel):

If you already followed these instructions, please update your install to the latest version of the docker image by running the code below in a macOS terminal:

docker pull vnijs/rsm-msba-intel;
docker rmi vnijs/rsm-jupyter-rs; # cleanup if needed
rm -rf ~/git/docker;
git clone https://github.com/radiant-rstats/docker.git ~/git/docker;
cp -p ~/git/docker/launch-rsm-msba-intel.sh ~/Desktop/launch-rsm-msba.command;
~/Desktop/launch-rsm-msba.command;

3.1.1 Update Docker resource setting on macOS (before workshop)

You should change the (maximum) resources docker is allowed to use on your system. We recommend you set this to approximately 50% of the maximum available on your system.

3.1.2 Update Docker Advanced Settings on macOS (before or during workshop)

On macOS you may need to change a setting so that the Docker Command Line Interface (CLI) tools are available at the System level. See the screenshot below for the settings you should use.

3.2 Setting up your terminal (before or during workshop)

If you want to use nicer fonts and icons in your terminal, follow the linked instructions to install the Meslo Nerd Fonts.

Download the four font files: * MesloLGS NF Regular * MesloLGS NF Bold * MesloLGS NF Italic * MesloLGS NF Bold Italic

Double-click on each file after downloading and click “Install”. This will make MesloLGS NF font available to all applications on your system.

On macOS install iTerm2 (https://iterm2.com/) and add it to the dock so you can easily access it in the future. Open iterm2 and make it your default terminal as shown in the screenshot below.

To change the font and icons:

iTerm2: Preferences → Profiles → Text and set Font to “MesloLGS NF”

On Windows open Windows Terminal to customize it. To change settings press CTRL + , and then first make Windows Terminal your Default terminal application and Ubuntu (22.04) your Default profile as shown in the screenshot below.

Next, click on the Ubuntu 22.04 icon on the left navigation menu and the starting directory is set to ~ as in the screenshot below.

Next, scroll down in Ubuntu (22.04) settings and click on Appearance. In the window that appears, set the font face to MesloGS NF. See screenshot below.

To finalize the docker setup we will configure the terminal “inside” the docker container available through the Launch Menu. Start the docker container, and press 5 + Enter to open a terminal. Press q + Enter, when prompted and then run the code below in the same terminal:

setup;
exit;

This can take a few minutes to run. When completed type exit and the press 5 + Enter again to open a new terminal.

Note: The new fonts may not show up right away. Is so try restarting your computer after the session.

For additional details see the page linked below (after workshop):

https://github.com/radiant-rstats/docker/blob/master/install/setup-ohmyzsh.md

Trouble shooting VPN on Windows

Check if you have internet connection from an Ubuntu terminal on Windows using the command below. If the printed output includes HTTP 200 you are fine.

curl -I https://www.google.com

If you have issues connecting to the internet from an Ubuntu terminal when VPN is on you can check the “Allow local (LAN) access when using VPN” box in Cisco VPN > Settings > Preferences as shown in the screenshot below

4 Discussion on tools for Business Analytics

See slide deck shared for the ICT session

5 Why use Docker?

See slide deck shared for the ICT session

6 VS Code

6.1 Setup VSCode on your local system (during workshop)

Microsoft’s open-source integrated development environment (IDE), VS Code or Visual Studio Code, was the most popular development environment based on a recent Stack Overflow developer survey. VS Code is widely used by Google developers and is the default development environment at Facebook.

VS Code can be installed from the link below and is an excellent, and very popular, editor for Python, R, and many other programming languages.

https://code.visualstudio.com/download

6.1.1 macOS

Open VS Code and press Shift + CMD + P and type “shell” in the input windows that opens. Then click on “Shell Command: Install ‘code’ command in PATH”

Run the code below from a terminal on macOS after installing VS Code to install relevant extensions:

cd ~/git/docker/vscode;
./extension-install.sh;
cd -;

See this link for more information

6.1.2 Windows

Run the code below from a PowerShell terminal after installing VS Code to install relevant extensions:

Invoke-WebRequest -Uri https://raw.githubusercontent.com/radiant-rstats/docker/master/vscode/extensions.txt -OutFile extensions.txt;
cat extensions.txt |% { code --install-extension $_ --force};
del extensions.txt;

See this link for more information

6.2 The command palette

On macOS, press Shift + CMD + P, and on Windows, press Shift + CTRL + P to open the Command Palette. The palette is used to search for and execute most commands. For example, type “Jupyter” and you will seen an option to create an new Jupyter notebook. Type “folder” and then select “File: Open Folder” to navigate to the project folder you want to use. Type “quarto” to render a Quarto file to HTML and type “rmd” to render an Rmarkdown file to HTML. Type “preferences” to change your user preference settings. Etc. etc.

6.3 Attaching VS Code to a running container

Start the docker container as usual. Now start VS Code and click on the Green >< sign on the bottom left of your screen. Click “Attach to Running Container”.

In the window that opens at the top of the screen, select (1) /rsm-msba-arm on macOS M1 or MS2 or (2) /rsm-msba-intel on other computers.

Press Shift + CTRL (CMD) + P to open the Command Palette and type “folder” and then select “File: Open Folder” to navigate to the project folder you want to use and then click on OK. Do NOT click on “Show Local” as that will take you out of the container.

When you execute code in Python you will be asked to select a “Kernel”. Choose the “base” kernel (Python 3.11.4). Now VS Code has direct access to all the tools built into the docker container.

6.4 VS Code resources

See also the resources listed in the install instructions for the RSM-MSBA docker image:

https://github.com/radiant-rstats/docker/blob/master/install/rsm-msba-macos-m1.md#using-vs-code

7 Using the RSM-MSBA (ARM or INTEL) docker container

7.1 Starting the RSM-MSBA computing environment

The easiest way to start the docker container is to double click the launch icon that was added to your desktop during the install process.

Windows:

On Windows your launch icon will be called launch-rsm-msba.bat. If you do not have a file called launch-rsm-msba.bat on your Desktop, you can create one by copy-and-pasting the code below in to a text file using notepad or VS Code. The pause line can be removed later if all works well. Open VS Code or notepad, copy-and-paste the code below into the editor, and save the file as launch-rsm-msba.bat to your Desktop. After saving, double-click the file on your desktop to get started.

wt.exe wsl.exe ~/git/docker/launch-rsm-msba-intel.sh -v ~;
pause;

In additional to the launch icon you can always start the docker container by running the command below in an Ubuntu terminal:

~/git/docker/launch-rsm-msba-intel.sh -v ~;

macOS (M1 or M2):

If you do not have a file called launch-rsm-msba.command on your Desktop, you can create one by running the code below from a macOS terminal:

cp -p ~/git/docker/launch-rsm-msba-arm.sh ~/Desktop/launch-rsm-msba.command;

In additional to the launch icon you can always start the docker container by running the command below in a macOS terminal:

~/git/docker/launch-rsm-msba-arm.sh -v ~;

macOS (Intel):

If you do not have a file called launch-rsm-msba.command on your Desktop, you can create one by running the code below from a macOS terminal:

cp -p ~/git/docker/launch-rsm-msba-intel.sh ~/Desktop/launch-rsm-msba.command;

In additional to the launch icon you can always start the docker container by running the command below in a macOS terminal:

~/git/docker/launch-rsm-msba-intel.sh -v ~;

7.2 Access RSM-MSBA (ARM or INTEL) computing environment on the MSBA server (any time)

https://rsm-compute-01.ucsd.edu:8000

Note: Accessing the server from off-campus requires VPN (see section below)

7.3 Using Jupyter Notebooks in VS Code (during workshop)

See the slides that will be shared for the ICT session

Copy-and-paste the command below into a terminal in VS Code to get materials for the ICT session. Running the command will create a folder rsm-ict-2023 in your home directory.

cd ~;
usethis --dest . "https://www.dropbox.com/scl/fo/f4d1113gdf7578j02bqv7/h?rlkey=pe3wr1fxbcojb4v82eoj7coi6&dl=1"

8 Where is my Data?

8.1 Accessing files from macOS

Open a Finder windows and navigate to your home directory. There should be a directory rsm-ict-2023 that we downloaded earlier (see screenshot below).

8.2 Accessing files from Windows

In an Ubuntu terminal, copy the code below

cd ~
explorer.exe ..

This will open a file explorer window. Right-click on your username and select “Pin to quick access” to make accessing files easier from both Windows and the docker container. See screenshot below.

8.3 Absolute and Relative paths

See the slides that will be shared for the ICT session

9 Connecting to PostgreSQL (aka postgres)

9.1 Accessing Postgres from Jupyter (during workshop)

Start the docker container and creat a new Jupyter Notebook in VS Code. From the Jupyter Notebook run:

from sqlalchemy import create_engine, inspect, text
import pandas as pd

## connecting to the rsm-docker database
engine = create_engine('postgresql://jovyan:postgres@127.0.0.1:8765/rsm-docker')

## add a table to the database
with engine.connect() as con:
    con.execution_options(isolation_level="AUTOCOMMIT")
    con.execute(text("CREATE TABLE IF NOT EXISTS films (title text, director text, year text)"))
    con.execute(text("INSERT INTO films (title, director, year) VALUES ('Thor: Love and Thunder', 'Taika Waititi', '2022')"))

df = pd.read_sql_query('SELECT * FROM films', con=engine.connect())
df

9.2 Accessing Postgres from pgweb (during workshop)

Start pgweb and enter the code below in the “Scheme” tab:

postgresql://jovyan:postgres@127.0.0.1:8765/rsm-docker

9.3 Accessing Postgres from VS Code (during workshop)

Start VS Code and click on the icon with the elephant in the left navigation bar. If you don’t see it, click on “…” in the left navigation bar and select “PostgreSQL Explorer”. The elephant icon should now be visible. Next, click on the + in top left of your VS Code window to Add Database Connection. Use:

  • 127.0.0.1 as the hostname
  • “jovyan” as the PostgreSQL user
  • “postgres” as the password
  • 8765 as the port number
  • Standard connection
  • “rsm-docker” as the database
  • “rsm-docker” as the display name

If there are no error messages, you successfully connected to the postgres server that is included in the docker container. See also the install instructions for the rsm-jupyter container linked above. You may not have any tables in your database (yet) so you may see printed information that the database is empty (i.e., “character(0)”).

See the YouTube video linked below for a introduction to the Postgres extension in VS Code:

https://www.youtube.com/watch?v=Cc9d2c8UuKA

See link below for more detailed examples on using postgres with Python:

Trouble shooting

If there is a connection issue, there is most likely a problem with the docker volume that stores the databases. Stop the docker container by pressing q + Enter in the launch menu and then copy the code below into an Ubuntu or macOS terminal and press Enter.

docker volume rm pg_data

Now start the docker container again and try the steps above to connect to the database again. If you continue to have issues, post to the Rady499 piazza site.

9.4 Adding Databases for the SQL class (during workshop)

Run the below from a terminal in Jupyter Lab to add databases:

source <(curl -s https://raw.githubusercontent.com/radiant-rstats/docker/master/postgres/postgres-createdb.sh)

To take a look at what this script does click on the link below:

https://raw.githubusercontent.com/radiant-rstats/docker/master/postgres/postgres-createdb.sh

To double check you have access to both databases that were added, start pgweb and enter the code below in the “Scheme” tab:

Northwind database:

postgresql://jovyan:postgres@127.0.0.1:8765/Northwind

WestCoastImporters database:

postgresql://jovyan:postgres@127.0.0.1:8765/WestCoastImporters

9.5 Adding Connections to the new databases in VS Code (during workshop)

Now lets add VSCode connections for the databases that you will use in the SQL + ETL class. Make the postgres extension visible (see above) and click on the + icon to add connections. Use:

  • 127.0.0.1 as the hostname
  • “jovyan” as the PostgreSQL user
  • “postgres” as the password
  • 8765 as the port number
  • Standard connection
  • “Northwind” as the database
  • “Northwind” as the display name

Click on the + icon one more time to add the final connection. Use:

  • 127.0.0.1 as the hostname
  • “jovyan” as the PostgreSQL user
  • “postgres” as the password
  • 8765 as the port number
  • Standard connection
  • “WestCoastImporters” as the database
  • “WestCoastImporters” as the display name

Trouble shooting

If you are getting a “password” error on macOS, look for keychain access on your Mac and then for ckolkman.vscode-postgres. Delete the entry for this app and then uninstall and re-install the Postgres extension in VS Code. You should now see the connections to databases that you created earlier. If these connections do not give you access to these databases, remove them and then re-create the connections.

10 Git and GitHub for version control

10.1 Create an account on GitHub (before or during workshop)

Visit the link below to signup for a student GitHub account.

https://github.com/

Provide the information below to set up your account. Your accout name must use the information below:

  • Email: Use your @ucsd.edu email address to qualify for a student account
  • Password: Choose a strong password that you can remember
  • Username: The format must be rsm-xyz123 where you replace xyz123 with the first part of your @ucsd.edu email address

The result would look something like the below. Follow the sign-up process, making sure to sign up as a STUDENT so you will get access to tools like GitHub Copilot for free.

10.2 Signup for access to Copilot, Copilot Chat, and Copilot Labs

When you sign up for GitHub as a student you can get free access to Copilot. Please also signup for the Copilot Chat and the Copilot Labs waitlists at the links below:

10.3 Why use Git and GitHub?

See the slides that will be shared for the ICT session

10.4 Introduce yourself to Git using GitGadget (during workshop)

Start the Docker Container and “Attach to Running Container” in VS Code. Open a Terminal in VS Code, start “r” (or R), enter the code below, and press return.

fs::dir_create(Sys.getenv("R_LIBS_USER"), recurse = TRUE)
remotes::install_github("vnijs/gitgadget", upgrade = "never")
packageVersion("gitgadget")

The printed output should be 0.8.0.

Press (4 + Enter) from the Launch Menu to start GitGadget. Enter you UCSD username and email and change the Server API to: https://api.github.com/.

Make sure your User type is set to student and that the Base directory is set to ~/git. Get a GitHub access token through the link below or by clicking the “Create” button in the “Introduce” tab in GitGadget.

https://github.com/settings/tokens/new?scopes=repo,workflow&description=RSM-MSBA

It is important that you set Expiration to “No Expiration”. You can delete the access token after you graduate from the MSBA program.

After creating your token and introducing yourself to git by clicking the “Introduce” button in GitGadget, you can access the token by running the command below by launch a terminal (5 + Enter) from the launch menu to print the content of the ~/.Renviron file:

cat ~/.Renviron

The content of .Renviron should look similar to the screenshot below:

Your GitHub token should also have been added to your .zshrc file. Check this using the command below from a terminal (5 + Enter):

cat ~/.rsm-msba/zsh/.zshrc

At the end of the printed file, you should see something similar to the below:

export GITHUB_PAT="ghp_123abc123ABC"

If you type the below into a terminal (5 + Enter) you should see the printed token value returned as well.

echo $GITHUB_PAT

After setup, GitGadget should look similar to the screenshot below, expect that vnijs should be replaced by the first part part of your @ucsd.edu email:

Next, click on the SSH key button and copy-and-paste the key, i.e., a loooooooong sequence of letters and numbers, shown at the bottom of the GitGadget window (note: you may need to scroll down and/or to the right to get the whole sequence) to the GitHub page that was automatically opened in a new tab in your default browser.

https://github.com/settings/ssh/new

Now lets restart the docker container to see if all changes are being picked up. Close the browser windows with JupyterLab and GitGadget and then find the terminal window with the launch menu. Click in the launch menu window and then press (q + Enter) to stop the container. Then start it back up again through the launcher icon on your Desktop or by using the command below from a terminal on your host sytem (i.e., Ubuntu on Windows or the terminal application or iTerm2 on macOS)

macOS (M1 or M2)

~/git/docker/launch-rsm-msba-arm.sh -v ~

macOS (Intel) and Windows

~/git/docker/launch-rsm-msba-intel.sh -v ~

Cloning your first repo

Start by creating a new repo on GitHub (https://github.com). The first time you clone a project from GitHub on a computer you should do it using a terminal because it will prompt you to confirm if you want to create a connection between your computer and the GitHub server. If your first repo on GitHub was labeled test1, then you could use the code below to clone your first repo, after changing the username.

mkdir ~/git;
cd ~/git;
git clone git@github.com:your-id/test1.git;
ls -l test1/;
rm -rf ~/git/test1;

If the code above ran without errors then you can use GitGadget or the Git and GitLens tools in VS Code to clone repos from now on.

10.6 Submit GitHub Account information for program use

Once you have completed the GitHub setup. Please provide your account information and the token using the form linked below.

https://docs.google.com/forms/d/e/1FAIpQLSco-udbayz7rlTOfrI4GA5y3I1Dk_sMdfxzE6Bn4ynyYRFn1A/viewform?usp=pp_url

10.7 How fix a merge conflict

See the slides that will be shared for the ICT session.

Fork the repo linked below to your personal account on GitHub. Then clone it to your ~/git/ folder using VS Code.

https://github.com/rady-ucsd/rsm-merge-conflict-practice

11 ChatGPT+ with Code Interpreter

You will need access to ChatGPT+ with Code Interpreter for the duration of the MSBA program. See the slides that will be shared for the ICT session for details.

Note: For the incoming FT and FW MSBA students Rady will provide a $100 fellowship to cover cost of the $20 subscription for the first 5 months.

12 Rstudio

12.1 Introduction to Rstudio (any time)

13 Installing Python and R packages

13.1 Installing python packages (during workshop)

Installing python packages using pip

We recommend using pip to install any additional packages you might need that are not already available in the RSM-MSBA docker container. Use the syntax below:

pip install --user "pyrsm>=0.9.3"`

pip is the package management command. install tells pip what you want to do and --user tells pip that you want to install this just for yourself in your home directory. This part is important if you want the package to remain available after restarting the docker container. Finally, pyrsm is the name of a python package that is available on PiPy

To remove packages installed using pip, use the below and enter “y” when prompted to confirm you want to remove the package:

pip uninstall xyz

Installing python packages using conda

To install Python modules that will not persist after restarting the docker container, enter code like the below from the terminal in Jupyter Lab:

conda install pyasn1`

After installing a module you will have to restart any running Python kernels to import the module in your code.

Conda convenience functions

To install Python modules that will persist after restarting the docker container, enter code like the below from the terminal in Jupyter Lab:

conda init zsh;
exit;

Reopen a terminal and run the below. Here myenv if a new conda environment and pyasn1 is a package to install.

cc myenv pyasn1

After refreshing your browser window showing JupyterLab you should see a new icon myenv. Click on this icon and run import pyasn1. If you do not see an error message you will have successfully created a new conda environment. You can now create your own conda environments with whatever packages you need.

You can also use the cc function to add more python package to a specific environment:

cc myenv package_a package_b package_c

To list all available conda environments, use the cl command from a terminal in JuyterLab. To remove a conda environment use cr myenv where myenv is the environment you want to remove. To export an environment to share with others, use ce myenv. This will create a myenv.yaml file with information on all packages used in the myenv environment. To import a new environment from an existing some_env.yaml file use ci some_env.yaml. This will create a new environment called some_env.

If you want to see the code included in these functions, run the code below:

cat /usr/local/bin/ccenv;
cat /usr/local/bin/cl;
cat /usr/local/bin/cr;
cat /usr/local/bin/ce;
cat /usr/local/bin/ci;

Switching conda environments in the terminal

If you want to change the conda environment used in a terminal you can use the command below:

conda activate myenv

To deactivate a conda environment use:

conda deactivate

When leaving a custom environment you will most likely want to switch to the base environment so instead of conda deactivate you can also use:

conda activate base

If you are using ohmyzsh and it is set up properly you should see what environment you are in when using a terminal. If not, then you can use the command below.

conda info | grep 'active env'

When you are working in a Jupyter Notebook in VS Code the kernel (environment) used should be shown in the top-right of the notebook. Note that the environment used in a terminal need not be connected to the environment that may be used in a notebook.

Tips to avoid the python problems depicted in the comic linked below: - Stick with one tool to create environments (e.g., conda) - Use pip or conda to add packages to an existing environment - Don’t go overboard with the number environments you create

https://xkcd.com/1987/

Adding conda and convenience functions to your local system

You can get Miniconda for your system from the page linked below:

https://docs.conda.io/en/latest/miniconda.html

Then run the commands below from a terminal on macOS or an Ubuntu terminal on Windows.

sudo cp ~/git/docker/files/cl.sh /usr/local/bin/cl;
sudo cp ~/git/docker/files/ccenv.sh /usr/local/bin/ccenv;
sudo cp ~/git/docker/files/cr.sh /usr/local/bin/cr;
sudo cp ~/git/docker/files/ce.sh /usr/local/bin/ce;
sudo cp ~/git/docker/files/ci.sh /usr/local/bin/ci;
sudo cp ~/git/docker/files/usethis /usr/local/bin/usethis;

Removing locally installed packages

To remove locally installed R packages press 8 (+ Enter) in the launch menu and follow the prompts. To remove locally installed Python modules press 9 (+ Enter) in the launch menu.

13.2 Installing R packages (during workshop)

To install the latest version of R-packages you need, add the lines of code shown below to ~/.Rprofile or copy-and-paste the lines into an R notebook.

if (Sys.info()["sysname"] == "Linux") {
  options(repos = c(
    RSPM = "https://packagemanager.posit.co/cran/__linux__/jammy/latest",
    CRAN = "https://cloud.r-project.org"
  ))
} else {
  options(repos = c(
    CRAN = "https://cloud.r-project.org"
  ))
}

This will be done for you automatically if you run the setup; exit; commands from a terminal inside the docker container. To install R packages that will persist after restarting the docker container, enter code like the below in R and follow any prompts. After doing this once, you can use install.packages("some-other-package") in the future.

Lets first check the output from the command below in R:

.libPaths()
## create user directory
fs::dir_create(Sys.getenv("R_LIBS_USER"), recurse = TRUE)

## install a package
install.packages("fortunes", lib = Sys.getenv("R_LIBS_USER"))
fortunes::fortune()

## remove the package again
remove.packages("fortunes", lib = Sys.getenv("R_LIBS_USER"))

13.3 Removing packages

Use 8 + Enter and 9 + Enter from the launch menu to remove packages you installed. To remove conda environments you created, use cr myenv as discussed above

14 Additional resources

14.1 Additional Python resources (any time)

If you are looking for additional python resources, see the links below:

Data Analysis with Python by Wes McKinney (Pandas) https://wesmckinney.com/book/

If you are struggling to follow a (small) piece of python code, the python tutor site is a great resources to walk through the execution step-by-step.

https://pythontutor.com/

14.2 Additional R resources (any time)

In R4DS you can read the following:

Chapters 1, 6, 8, 17, 19, 20, 21, 26, 27

Getting started with markdown: https://www.markdownguide.org/getting-started/

The Rmarkdown book: https://bookdown.org/yihui/rmarkdown/

If you are struggling with a piece of R code using tidyverse verbs, the tidyverse tutor site is a great resources to walk through the execution step-by-step.

https://tidydatatutor.com/

14.3 Data Science at the Command Line (any time)

https://www.datascienceatthecommandline.com

Note: You can read the 2nd edition1 for free online

https://datascienceatthecommandline.com/2e/

14.6 Radiant function reference (any time)

14.7 Prepare for Data Science interviews (any time)

A creative overview of (basic) requirements for Data-Science interviews.

https://www.youtube.com/watch?v=4Z6lxfglvUU

Important: Connect with the Rady Career Center to start your own job-search journey. Do this ASAP!